package com.jeasonzhao.report.codes;

import com.jeasonzhao.commons.basic.IntegerPair;

public final class ReportMergeModes extends IntegerPair
{
	private static final long serialVersionUID = 1L;
	public static final ReportMergeModes None = new ReportMergeModes(0,"不分组，不小计",null);
    public static final ReportMergeModes Subtotal = new ReportMergeModes(1,"底部分组小计","d,default,sum");
    public static final ReportMergeModes Subtotal_All = new ReportMergeModes(2,"全部底部分组小计","da,sum_all,sumall,allsum");
    public static final ReportMergeModes TopSubtotal = new ReportMergeModes(3,"顶部分组小计","t,top,topsum");
    public static final ReportMergeModes TopSubtotal_All = new ReportMergeModes(4,"全部顶部分组小计","ta,topall,top_all,topsumall,topsum_all,alltop");
    public static final ReportMergeModes Merge_Only = new ReportMergeModes(5,"只分组不小计","merge,m");
    public boolean isNone()
    {
        return this.equals(None);
    }

    public int hashCode()
    {
        return super.hashCode();
    }

    public boolean isMerge()
    {
        return this.equals(Merge_Only) || this.isSubtotal();
    }

    public boolean isMergeOnly()
    {
        return this.equals(Merge_Only);
    }

    public boolean isSubtotal()
    {
        return this.equals(Subtotal)
            || this.equals(Subtotal_All)
            || this.equals(TopSubtotal)
            || this.equals(TopSubtotal_All)
            ;
    }

    public boolean isSubtotalAll()
    {
        return this.equals(Subtotal_All)
            || this.equals(TopSubtotal_All)
            ;
    }

    public boolean isSubtotalTop()
    {
        return this.equals(TopSubtotal)
            || this.equals(TopSubtotal_All)
            ;
    }

    protected ReportMergeModes(int nId,String strName,String str)
    {
        super(nId,strName,str);
    }

    public static ReportMergeModes fromName(String str)
    {
        return(ReportMergeModes) IntegerPair.findConstant(ReportMergeModes.class,str,None);
    }
}
